import { PinlistAPI, UserAPI } from './api';
export async function fetchPinInfo(pinID) {
  try {
    console.log(pinID);
    const response = await PinlistAPI.getPinById(pinID); // 调用接口获取拼车信息
    let pinInfo_tmp = response; // 存储返回的数据
	let userinfo=(await UserAPI.getUserById(pinInfo_tmp.leader));
	pinInfo_tmp.leaderName=userinfo['username']
	pinInfo_tmp.creditRating=userinfo['creditRating']
    console.log('Fetched Pin Info:', pinInfo_tmp);
	return pinInfo_tmp;
  } catch (error) {
    console.error('Failed to fetch pin info:', error);
  }
}